package com.xsr.controller;

import com.xsr.domain.Book;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 邢式瑞
 * @version 1.0
 * @project restFul
 * @date 2022/9/8 22:37
 */
@RestController
@RequestMapping("/Books")
public class BookController {
    @PostMapping
    public  String save(Book book){
        System.out.println(book);
        return "{'module':'book save success'}";
    }
    @GetMapping
    public List<Book> getAll(){
        List<Book>  list=  new ArrayList();
     Book book=   new Book();
      book.setType("计算机");
      book.setName("hhh");
      book.setDescription("jiuu");
        Book book2=   new Book();
        book2.setType("计算机2");
        book2.setName("hhh2");
        book2.setDescription("jiuu2");

        return list;
    }
}
